package com.guochenglang.www.dao.impl;

import com.guochenglang.www.dao.CollectUserDao;
import com.guochenglang.www.pojo.CollectUser;
import com.guochenglang.www.util.GetTable;
import com.guochenglang.www.util.connect.JdbcUtil;

import java.sql.SQLException;
import java.util.ArrayList;

/**
 * 关注用户表的的Dao层
 *
 * @author GuoChenglang
 */
public class CollectUserDaoImpl implements CollectUserDao {
    /**
     * 表名
     */
    private static final String TABLE = GetTable.getTable(CollectUser.class);

    @Override
    public ArrayList<CollectUser> collectUserSelect(CollectUser collectUser) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException {
        return JdbcUtil.selectMax(TABLE, collectUser);
    }

    @Override
    public ArrayList<CollectUser> collectUserSelectByLimit(int page, int num, CollectUser conditions, String order, String mode) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException {
        return JdbcUtil.selectByLimit(TABLE, page, num, conditions, order, mode);
    }

    @Override
    public int insertCollectUser(CollectUser collectUser) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException {
        return JdbcUtil.insert(TABLE, collectUser);
    }

    @Override
    public int deleteCollectUser(CollectUser collectUser) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException {
        return JdbcUtil.delete(TABLE, collectUser);
    }
}
